﻿using System;
using System.Collections.Generic;
using System.Text;
using DeviceSDK.NetTraffic.Baidu;
using BaseHelper.Base;
using System.Collections;
using DeviceSDK.NetTraffic;
using DeviceSDK.NetTraffic.Gaode;
using DeviceSDK.NetTraffic.HighWay;

namespace DeviceSDK.NetTraffic
{
    public class NetTrafficHelper
    {
        public enum RadarDataType {HaiKangJam,HaiKangCount,DaHua }

        //监听端口

        private static object locker = new object();
        public static int Collect_Sleep = 60;
        public static string Api_Key_Baidu = "";
        public static string Api_Key_Gaode = "";
        public static string Api_TravelTime_Source = "";
        public static string Error="";


        public static void Init()
        {
            BaiduMap_JiaoTong.Init();
        }

        public static int Set_ApiListen(string FirmModelIDName, string CityID, string TrafficID)
        {
            int ret = -1;
            if (FirmModelIDName == "BAIDUMAP_JIAOTONG")
            {

                return 1;// BaiduMap_JiaoTong.Set_ApiListen(CityID, TrafficID);
            }
            else
            {
                ret = 1;
                Error = "设备型号不支持！";
            }

            return ret;
        }


        public static int Set_MapPointListen(string FirmModelIDName, string SectionID, string MapPoint)
        {
            int ret = -1;
            if (FirmModelIDName == "BAIDUMAP_POINT")
            {
                return BaiduMap_JiaoTong.Set_MapPointListen(SectionID,MapPoint);
            }
            else
            {
                ret = 1;
                Error = "设备型号不支持！";
            }

            return ret;
        }

        public static int Set_StopMapPointListen(string FirmModelIDName, string SectionID)
        {
            int ret = -1;
            if (FirmModelIDName == "BAIDUMAP_POINT")
            {
                return BaiduMap_JiaoTong.Set_StopMapPointListen(SectionID);
            }
            else
            {
                ret = 1;
                Error = "设备型号不支持！";
            }

            return ret;
        }

        public static string Get_Data(string FirmModelIDName, string CityID, string TrafficID)
        {
            string ret="";           
            if (FirmModelIDName == "BAIDUMAP_JIAOTONG")
            {
                return BaiduMap_JiaoTong.Get_Data(CityID, TrafficID);
            }
            else
            {
                Error = "接口类型不支持！";
            }

            return ret;
        }

        public static TravelInfo Get_Travel_Time_Api(string PosStart, string PosPass, string PosEnd, string Tactics = "0")
        {
            if (Api_TravelTime_Source == "BAIDU")
                return  BaiduMap_JiaoTong.Get_Travel_Time_Api(PosStart, PosPass, PosEnd);
            else if (Api_TravelTime_Source == "GAODE")
                return  GaodeMap_JiaoTong.Get_Travel_Time(PosStart, PosPass, PosEnd);

            return null;
        }

        public static Hashtable Get_HighWay_StationInfo(string Provice, string StationName, string Direction, string K)
        {
            if (Provice.StartsWith("河北"))
                return HebeiApi.Get_StationInfo(StationName, Direction, K);

            return null;           
        }

        //设备-关闭数据
        public static int Set_Close(string FirmModelIDName)
        {
            if (FirmModelIDName == "BAIDUMAP")
            {
                BaiduMap_JiaoTong.Set_Close();
            }
            return 0;
        }


    }
}
